import http from "./http"
//axios再次封装
interface axiosrequest {
    url: string,
    method?: any,
    params?: any,
    data?: any,
    headers?: any
}

interface CostomResponse {
   readonly code:number,
    data: any,
   readonly msg:any
}

export default function request({ url, method, params, data, headers }: axiosrequest) :Promise<CostomResponse> {
    return new Promise((resolve) => {
        http({
            url,
            method,
            params,
            data,
            headers
        }).then(res => {
            resolve({code: res.data.code,data: res.data.data,msg:res.data.msg})
        })
    })
   
}